﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
using DGIS.SysSetting.Core.Model;
using DGIS.SysSetting.Core.Service.Win;
using Newtonsoft.Json;
using Test.Network;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //EnvTest();
            SysTimeTest();
            Console.ReadLine();
        }

        static void NetworkTest()
        {
            var item = Network.NetworkTest.Get("Realtek PCIe GBE Family Controller");
            item.Ip = "192.168.1.156";
            item.Mask = "255.255.255.0";
            item.Gateway = "192.168.1.1";
            item.Dns = new List<string>()
            {
                "114.114.114.114",
                "8.8.8.8"
            };
            bool result = Network.NetworkTest.Set(item);

            Console.WriteLine(result ? "成功" : "失败");
        }

        static void EnvTest()
        {
            var items = Env.EnvTest.Get();
            string[] paths = Env.EnvTest.GetPath();

            foreach (EnvVariables item in items)
            {
                Console.WriteLine(string.Format("{0}:{1}", item.Name, item.Value));
            }
        }

        static void SysTimeTest()
        {
            SystemTime sysTime=new SystemTime();
            SysTimeService.GetLocalTime(sysTime);

            DateTime now=DateTime.Now;

            Console.WriteLine(string.Format("{0}-{1}-{2} {3}:{4}:{5}",sysTime.vYear,sysTime.vMonth,sysTime.vDay,sysTime.vHour,sysTime.vMinute,sysTime.vSecond));
            Console.WriteLine(string.Format("{0}-{1}-{2} {3}:{4}:{5}.{6}", now.Year,now.Month,now.Day,now.Hour,now.Minute,now.Second,now.Millisecond));


        }
    }
}
